import { IQueryParams } from './queryParams'
import { IPagination } from './pagination'
import { Contact } from './contact'
import { propertyMap } from '@shared/decorators/property-map'
import { User } from './user'

export interface IMerchantQueryParams extends IQueryParams {
  startTime?: string,
  endTime?: string,
  insCode?: string,
  insName?: string,
  intMerCode?: string,
  merName?: string,
  agentCode?: string,
  status?: string,
}

export class MerchantFull {
  merchant: Merchant
  users: User[] = []
  constructor() {
    this.merchant = new Merchant()
  }
}

export class MerchantCommon {
  insCode: string
  insName: string
  insNameEN: string
  agentCode: string
  agentName: string
  agentNameEN: string
  intMerCode: string
  merName: string
  merNum: string
  merNameEN: string
  contact: Contact
  status: string
  /** 新授权码 */
  authPassword: string
  authPasswordCF?: string
  tradeInfo?: ITradeInfo

  constructor() {
    this.contact = new Contact()
    this.tradeInfo = {}
  }
}

export interface ITradeInfo {
  authPassword?: string
  authPasswordCF?: string
}

export class Merchant {
  common: MerchantCommon
  version: number
  createdAt: string
  updatedAt: string

  constructor() {
    this.common = new MerchantCommon()
  }
}

export class ICreateMerchant {
  merchant: Merchant
  users: User[]

  constructor() {
    this.merchant = new Merchant()
    this.users = []
  }
}

export interface IMerchantPagination extends IPagination {
  data: Merchant[]
}
